package com.ryan.framework.tag.pagination;

import java.io.Serializable;

import com.ryan.dictionary.framework.enums.PageInitDataEnum;

public class Page implements Serializable {

	private static final long serialVersionUID = 8007944048337473098L;
	// 默认每页显示记录数
	private Integer pageSize = new Integer(PageInitDataEnum.PAGE_SIZE.getValue());
	// 页码
	private Integer targetPage=new Integer(PageInitDataEnum.TARGET_PAGE.getValue());
	// 记录总数
	private Integer totalRecord=new Integer(PageInitDataEnum.TOTAL_RECORD.getValue());

	public Page(){}
	
	public Page(Integer pageSize , Integer targetPage){
		this.pageSize = pageSize;
		this.targetPage = targetPage;
	}

	/**
	 * @return Returns the totalPage.
	 */
	public Integer getTotalPage() {
		if (totalRecord.intValue() <= 0) {
			return 0;
		} else {
			return ((totalRecord.intValue() - 1) / pageSize.intValue()) + 1;
		}
	}

	public Integer getPageSize() {
		return pageSize;
	}

	public void setPageSize(Integer pageSize) {
		this.pageSize = pageSize;
	}

	public Integer getTargetPage() {
		return targetPage;
	}

	public void setTargetPage(Integer targetPage) {
		this.targetPage = targetPage;
	}

	public Integer getTotalRecord() {
		return totalRecord;
	}

	public void setTotalRecord(Integer totalRecord) {
		this.totalRecord = totalRecord;
	}

}
